package controllayer;


import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class DVDCtrlTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class DVDCtrlTest
{
    /**
     * Default constructor for test class DVDCtrlTest
     */
    public DVDCtrlTest()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }

    @Test
    public void addCopy()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "123456789", "11/11/1111");
        assertEquals("Copy created", dVDCtrl1.addCopy("Die Hard", "1", "11/11/1111", "175"));
        dVDCtrl1.deleteDVD("Die Hard");
    }

    @Test
    public void createDVD()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        assertEquals("DVD created", dVDCtrl1.createDVD("Die Hard", "123456789", "11/11/1111"));
        dVDCtrl1.deleteDVD("Die Hard");
    }

    @Test
    public void deleteDVD()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "123456789", "11/11/1111");
        assertEquals("DVD has been deleted!", dVDCtrl1.deleteDVD("Die Hard"));
    }

    @Test
    public void deleteCopy()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "123456789", "11/11/1111");
        dVDCtrl1.addCopy("Die Hard", "1", "11/11/1111", "175");
        assertEquals("Copy deleted! \n", dVDCtrl1.deleteCopy("Die Hard", "1"));
       dVDCtrl1.deleteDVD("Die Hard");
    }

    @Test
    public void editDVD()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "123456789", "11/11/1111");
        assertEquals(true, dVDCtrl1.editDVD("Die Hard", "Die Hard 2", "1234567890", "11/12/1999"));
        dVDCtrl1.deleteDVD("Die Hard 2");
    }

    @Test
    public void findDVD()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "1234567890", "11/12/1999");
        assertNotNull(dVDCtrl1.findDVD("Die Hard"));
        dVDCtrl1.deleteDVD("Die Hard");
    }

    @Test
    public void findCopy()
    {
        controllayer.DVDCtrl dVDCtrl1 = new controllayer.DVDCtrl();
        dVDCtrl1.createDVD("Die Hard", "1234567890", "11/12/1999");
        dVDCtrl1.addCopy("Die Hard", "1", "11/11/1111", "175");
        assertNotNull(dVDCtrl1.findCopy("Die Hard", "1"));
        dVDCtrl1.deleteDVD("Die Hard");
    }
}



